package com.lingchen.boot.utils;

import com.opencsv.CSVReader;
import com.opencsv.CSVReaderBuilder;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.List;

public class CSVUtils {

    /**
     * 导入
     *
     * @param fis csv文件
     * @return
     */
    public static List<String[]> importCsv(FileInputStream fis,String charset) {
        try {
            CSVReader csvReader = new CSVReaderBuilder(new BufferedReader(new InputStreamReader(fis, charset))).build();
            List<String[]> strings = csvReader.readAll();
            return strings;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;

    }

}